import smtplib
from email.mime.text import MIMEText
from email.utils import formataddr


def email(email_list, content, subject="小土家--用户注册"):  # email_list邮件列表，content邮件内容，subject：发送标题
    msg = MIMEText(content, 'plain', 'utf-8')
    msg['From'] = formataddr(["小土家", 'jingsongxiansheng@foxmail.com'])
    msg['Subject'] = subject

    server = smtplib.SMTP("pop.qq.com", 25)  # 邮箱引擎
    server.login("jingsongxiansheng@foxmail.com", "*********")  # 邮箱名，密码
    server.sendmail('jingsongxiansheng@foxmail.com', email_list, msg.as_string())
    server.quit()